package client;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class PanneauConnexion extends JPanel implements ActionListener  {

	// Panel Label et champs
	private JPanel panneauChamp = new JPanel();
	private JTextField login = new JTextField(10);
	private JPasswordField password = new JPasswordField(10);
	private JLabel id = new JLabel("Identifiant");
	private JLabel mdp = new JLabel("Mot de passe");

	// Panel Bouton
	private JPanel panneauBouton = new JPanel();
	protected JButton ok = new JButton("Valider");
	private JButton cancel = new JButton("Annuler");

	public PanneauConnexion() 
	{
		cancel.addActionListener(this);
		
		this.setLayout(new BorderLayout(0,10));

		// Insertion du second panel avec les champs
		panneauChamp.setLayout(new GridLayout(2,1,0,10));
		panneauChamp.add(id);
		panneauChamp.add(login);
		panneauChamp.add(mdp);
		panneauChamp.add(password);
		this.add(panneauChamp, BorderLayout.NORTH);

		// Insertion du troisieme panel avec les boutons
		panneauBouton.setLayout(new GridLayout(1,2,10,0));
		panneauBouton.add(ok);
		panneauBouton.add(cancel);
		this.add(panneauBouton,BorderLayout.SOUTH);

		getInsets();
	}

	public Insets getInsets()
	{
		return new Insets(10,10,10,10);
	}//getInsets()

	public void actionPerformed(ActionEvent telEvenement)
	{
		if(telEvenement.getSource()== cancel)
		{
			System.exit(0); 
		}
		
	}
}

